﻿using CommunityToolkit.Mvvm.Input;
using System.Collections.ObjectModel;

namespace ItemsPanelMainCommand.ViewModels;

public partial class MainViewModel : ViewModelBase
{
    public ObservableCollection<ItemModel> Items { get; } = new ObservableCollection<ItemModel>();

    public MainViewModel()
    {
        for (int i = 0; i < 50; i++)
        {
            this.Items.Add(new ItemModel("Item " + (i + 1)));
        }
    }

    [RelayCommand]
    private void Delete(ItemModel item)
    {
        this.Items.Remove(item);
    }
}
